﻿using System.Windows.Input;
using Hx.Components.Models;

namespace Hx.Components
{
    public partial class ArticleRow
    {
        public MouseButtonEventHandler TitleClick;

        public ArticleRow(ArticleModel article)
        {
            InitializeComponent();

            Article.Text = article.Title;
            Category.Text = "【" + article.ParentCategoryName + "】 - 【" + article.CategoryName + "】";
            Bottom.Text = article.AuthorName + article.CreateTime.ToString("yyyy.MM.dd HH:mm:ss");
        }

        private void Title_Click(object sender, MouseButtonEventArgs e)
        {
            if (TitleClick != null)
            {
                TitleClick(sender, e);
            }

            //WebApiHelper.GetResponseModel<ArticleModel>(String.Format(UrlDefinition.GetArticle, _article.Id), null,
            //    article =>
            //    {
            //        var articleShow = new ArticleShowWindow();
            //        articleShow.ShowContent(article);
            //        articleShow.WindowState = System.Windows.WindowState.Maximized;
            //        articleShow.Show();
            //    });
        }
    }
}